var jquery = require('cheerio');
var fs=require('fs');
module.exports = class extends baseController {
    constructor() {
        super();

        this.router.all('/', this.index.bind(this));

        return this.router;
    }

    static init() {
        return new this();
    }

 
//没用这个
    async index(req, res,next) {
       
        try {
            let tmp = require('../static/template/default/views/index/index.marko');
            let data = {
                viewData: {
                    info: 'this is a test page'
                }
            };
          //  tmp.render(data, res);

            tmp.renderToString(data,function (err,html) {
                if(html){
                    let $ = jquery.load(html);
                   // $("title").text("111");
                    html=$.html();
                    res.send(html);
                }else{
                    next(err);
                }

            });


        } catch (err) {
            next(err);
        }
    }

 
};